package com.wbs.controller;

import com.wbs.resutil.Result;
import com.wbs.service.OrderService;
import com.wbs.vo.PayVo;
import org.apache.ibatis.annotations.UpdateProvider;
import org.checkerframework.checker.units.qual.UnitsMultiple;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;

/**
 * @Author: 芝梦
 * @Description: 订单控制层
 * @DateTime: 2024/2/27 17:55
 */
@RestController
@RequestMapping("order")
public class OrderController {
    @Autowired
    private OrderService orderService;

    @GetMapping("submitOrder")
    public Result submitOrder(@RequestHeader String token, @RequestParam String paymentType, @RequestParam Long addrId){
        PayVo payVo = orderService.submitOrder(token, paymentType, addrId);
        return Result.SUCCESS().setData(payVo);
    }

    @PutMapping("updateBatch")
    public void updateBatch(@RequestBody ArrayList<String> orderNo,@RequestParam String trade_no){
        orderService.updateBatch(orderNo, trade_no);
    }
}
